## Text analysis 

### Read in hand-coded data for respondents who do not see a progressive woman

## setwd("/Users/sparshasaha/Dropbox/Seeking More Why Women Fail/Pol Behavior Rep Files Ambitious Women 02282020")

gendat2 <- read.csv("NoProgWomen.csv")
nrow(gendat2) 

gendat2 <- gendat2[!(is.na(gendat2$Q35) | gendat2$Q35==""), ]
dim(gendat2)
## 195 when NAs are removed

## what is the share of Dems and Reps who mention gender in criteria

mean(gendat2$gender_criterion[gendat2$Party3=="Democrat"]) 
mean(gendat2$gender_criterion[gendat2$Party3=="Republican"])

## Is this difference significant? Need a chi square test

gen.data = table(gendat2$gender_criterion, gendat2$Party3) 
print(gen.data)

# Perform the Chi-Square test.
print(chisq.test(gen.data)) 
##not significant; p= 0.125

###### Now look at those who do see an ambitious woman 

gendat <- read.csv("Progressive Women.csv")
nrow(gendat) ##170 people 

## what is the share of Dems and Reps who mention gender in criteria

mean(gendat$gender_criterion[gendat$Party3=="Democrat"]) 
mean(gendat$gender_criterion[gendat$Party3=="Republican"])

gen.data = table(gendat$gender_criterion, gendat$Party3) 
print(gen.data)

# Perform the Chi-Square test.
print(chisq.test(gen.data)) 
##sig at p = 0.01 